package com.lvmama.rhino.common.utils

import org.apache.spark.SparkContext
import org.apache.spark.sql.{SQLContext, SparkSession}

/**
  * Created by yuanxiaofeng on 2017/6/1.
  */
object SQLContextSingleton {
  @transient private var instance: SQLContext = _

  def getInstance(sparkContext: SparkContext): SQLContext = {
    if (instance == null) {
//      instance = new SQLContext(sparkContext)
        instance = SparkSession.builder().getOrCreate().sqlContext
    }
    instance
  }
}
